/*******************************************************************************
 * Venice Noise Android Application
 * Copyright (C) 2011  Worcester Polytechnic Institute, Wesley Ripley
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; version 2
 * of the License
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 * 
 * If you plan to use or modify any of this code please contact Fabio Carrera (carrera.fabio@gmail.com)
 * Also please attribute any code used in the final product to the developers. 
 * 
 * Author: Wesley Ripley (wripley@wpi.edu) 
 *******************************************************************************/
package org.venicenoise.app.location;

import android.location.Location;
import android.location.LocationListener;

/**
 * A location service for a static, unchanging location
 * @author Wesley Ripley
 * @version 12/16/2011
 */
public class StaticLocationService implements LocationService {

	private final Location location;
	
	/**
	 * Constructor for a StaticLocationService
	 * @param location
	 * 		The location to fix this location service at
	 */
	public StaticLocationService(Location location)
	{
		this.location = location;
	}
	
	/**
	 * Constructor for a StaticLocationService
	 * @param latitude
	 * 		The latitude to fix this location at
	 * @param longitude
	 * 		The longitude to fix this location at
	 * @param accuracy
	 * 		The accuracy of the location this location service will provide
	 * @param bearing
	 * 		The bearing of the location this location service will provide
	 */
	public StaticLocationService(double latitude, double longitude, float accuracy, float bearing) 
	{
		location = new Location("NONE");
		location.setLatitude(latitude);
		location.setLongitude(longitude);
		location.setAccuracy(accuracy);
		location.setBearing(bearing);
	}

	public void startLocating() {
		//location is static, so do nothing
	}

	public void stopLocating() {
		//location is static, so do nothing
	}
	
	public boolean isLocating()
	{
		return true;
	}

	public boolean locationAvailable() {
		//location is always available
		return true;
	}
	
	public Location getLocation()
	{
		return new Location(location);
	}

	public void addLocationListener(LocationListener listener) {
		//location never changes, no need to do anything with listeners
	}

	public void removeLocationListener(LocationListener listener) {
		//location never changes, no need to do anything with listeners
	}

	public void notifyAllLocationChanged(Location location) {
		//location never changes, no need to do anything with listeners
	}

}
